
import { topDesignData } from "@/types/tempData";

// 根据key查找对象
export const findModeByKey = (key: string, item: ICeilingStyle) => {
  let obj = item.modelProperty.modelParameterValueMap.find(k => k.key == key)?.modelParameterValue

  return obj
}

//获取
export const sortCeilingStyle = (item: ICeilingStyle) => {
  let areaModelList: ModelParameterValueMap$4[][] = []
  let modelList: ModelParameterValueMap$4[] = []
  let obj: ModelParameterValueMap$4 | undefined
  item.areaModelProperty.forEach(area => {
    let objs: ModelParameterValueMap$4[] = []
    area.modelParameterList[0].modelParameterKeyList.find(key => {
      obj = area.modelParameterValueMap.find(i => i.key == key)
      obj && objs.push(obj)
    })
    areaModelList.push(objs)
  })

  let obj2: ModelParameterValueMap$4 | undefined
  item.modelProperty.modelParameterList[0].modelParameterKeyList.forEach(key => {
    obj2 = item.modelProperty.modelParameterValueMap.find(k => k.key == key)
    obj2 && modelList.push(obj2)
  })



  return {
    areaModelList,
    modelList
  }
}

export const getModelLabel = (key: string, item: ModelParameterValueMap$4[]) => {
  return item.find(i => i.key == key)?.modelParameterValue

}



// 测试用的方法
export const getItem = (id: string) => {
  return topDesignData.ceilingStyles.find(i => i.id == id)
}